package com.lagou.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.lagou.common.pojo.Products;
import com.lagou.product.mapper.ProductMapper;
import com.lagou.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.criteria.CriteriaBuilder;

@Service //service层  注入到spring中
public class ProductServiceImpl implements ProductService{

    @Autowired
    private ProductMapper productMapper;


    /**
     * 根据商品ID查询商品对象
     */
    @Override
    public Products findById(Integer id) {
        return productMapper.selectById(id);
    }


    /**
     * 根据商品ID修改
     */

    @Override
    public int updateById(Products products ) {

        return productMapper.updateById(products);
    }




    /**
     * 根据商品ID删除
     */
    @Override
    public int deleteById(Integer id) {
        return productMapper.deleteById(id);
    }


}
